package com.example.springbootsecuritydemo.encoder;

/**
 * @author chaird
 * @create 2021-06-24 10:34
 */
import org.springframework.security.crypto.password.PasswordEncoder;

public class MyPasswordEncoder implements PasswordEncoder {
  @Override
  public String encode(CharSequence charSequence) { // 加密算法,此处没有加密
    String str = charSequence.toString();
    return str;
  }

  @Override
  public boolean matches(CharSequence charSequence, String s) {

    String target = charSequence.toString();
    if (target != null && s != null && target.equals(s)) {
      System.out.println("登陆成功");
      return true;
    }
    System.out.println("登陆失败");
    return false;
  }
}
